//
//  SVProgressHUD+TL.m
//  Coding_iOS
//
//  Created by taolei-mac on 2018/1/3.
//  Copyright © 2018年 com.lianchuan. All rights reserved.
//

#import "SVProgressHUD+TL.h"

@implementation SVProgressHUD (TL)

+ (void)initialize
{
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
    [SVProgressHUD setBackgroundColor:[UIColor blackColor]];
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
    [SVProgressHUD setCornerRadius:6.0];
}

+ (void)showLoading:(NSString *)message
{
    [SVProgressHUD setMinimumSize:CGSizeMake(120, 45)];
    if(!message || [message isEqualToString:@""]){
        [SVProgressHUD show];
    }else{
        [SVProgressHUD showWithStatus:message];
    }
}

+ (void)showNetworkError
{
    [SVProgressHUD setMinimumSize:CGSizeMake(120, 45)];
    [SVProgressHUD showInfoWithStatus:@"网络异常"];
    [SVProgressHUD dismissWithDelay:1.5];
}

+ (void)showAlert:(NSString *)message
{
    [SVProgressHUD setMinimumSize:CGSizeMake(120, 45)];
    if(message.length > 0){
        [SVProgressHUD showInfoWithStatus:message];
        [SVProgressHUD dismissWithDelay:2.0];
    }
}

+ (void)showError:(NSString *)message
{
    [SVProgressHUD setMinimumSize:CGSizeMake(120, 45)];
    [SVProgressHUD showErrorWithStatus:message];
    [SVProgressHUD dismissWithDelay:1.5];
}

+ (void)showSuccess:(NSString *)message
{
    [SVProgressHUD setMinimumSize:CGSizeMake(120, 45)];
    [SVProgressHUD showSuccessWithStatus:message];
    [SVProgressHUD dismissWithDelay:1.5];
}

@end
